package com.ruoyi.project.system.question.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.question.mapper.ExamRecordMapper;
import com.ruoyi.project.system.question.domain.ExamRecord;
import com.ruoyi.project.system.question.service.IExamRecordService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 答题记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-15
 */
@Service
public class ExamRecordServiceImpl implements IExamRecordService 
{
    @Autowired
    private ExamRecordMapper examRecordMapper;

    /**
     * 查询答题记录
     * 
     * @param id 答题记录主键
     * @return 答题记录
     */
    @Override
    public ExamRecord selectExamRecordById(Long id)
    {
        return examRecordMapper.selectExamRecordById(id);
    }

    /**
     * 查询答题记录列表
     * 
     * @param examRecord 答题记录
     * @return 答题记录
     */
    @Override
    public List<ExamRecord> selectExamRecordList(ExamRecord examRecord)
    {
        return examRecordMapper.selectExamRecordList(examRecord);
    }

    /**
     * 新增答题记录
     * 
     * @param examRecord 答题记录
     * @return 结果
     */
    @Override
    public int insertExamRecord(ExamRecord examRecord)
    {
        examRecord.setCreateTime(DateUtils.getNowDate());
        return examRecordMapper.insertExamRecord(examRecord);
    }

    /**
     * 修改答题记录
     * 
     * @param examRecord 答题记录
     * @return 结果
     */
    @Override
    public int updateExamRecord(ExamRecord examRecord)
    {
        examRecord.setUpdateTime(DateUtils.getNowDate());
        return examRecordMapper.updateExamRecord(examRecord);
    }

    /**
     * 批量删除答题记录
     * 
     * @param ids 需要删除的答题记录主键
     * @return 结果
     */
    @Override
    public int deleteExamRecordByIds(Long[] ids)
    {
        return examRecordMapper.deleteExamRecordByIds(ids);
    }

    /**
     * 删除答题记录信息
     * 
     * @param id 答题记录主键
     * @return 结果
     */
    @Override
    public int deleteExamRecordById(Long id)
    {
        return examRecordMapper.deleteExamRecordById(id);
    }
}